<?php
class RoleModel extends Model {
	public $list;
	public function getList($id=0,$i=0,$user_id = array()){
		$user_id['r.pid'] = $id;
		$re = $this-> alias('r') -> join("left join __USER__ as u on u.id = r.user_id") -> where($user_id) -> Field('r.*, u.account, u.nickname') -> select();
		
		if(false == $re) return null;
		foreach ($re as $v){
			$v['cl']=$i;
		    $this->list[]=$v;
			array_merge($this->list,$this->getList($v['id'],$i+1, $user_id));
		}
		return $this->list;
	}
}

?>